package main

import "fmt"

func main() {

	defer func() {
		// Make sure to rollback when panic, Block error or Commit error
		if err := recover(); err != nil {
			fmt.Println("出现异常了:", err)
		}
	}()
	nilMap()
}

func nilMap() {
	var mp map[string]int
	mp["a"] = 1
	fmt.Println(mp) // panic: assignment to entry in nil map
}
